package main

import (
	"multimedia/http"
	"os"
	"os/signal"
	"syscall"

	log "github.com/sirupsen/logrus"
)

func main() {
	c := make(chan os.Signal, 1)
	signal.Notify(c, syscall.SIGHUP, syscall.SIGQUIT, syscall.SIGTERM, syscall.SIGINT)

	err := http.Start()
	if err != nil {
		log.WithField("func:", "main").Errorf("service start error exit()")
		return
	}
	http.WSStart()
	http.WhiteboardSrvStart()
	for {
		s := <-c
		log.Infof("impro-http get a signal %s", s.String())
		switch s {
		case syscall.SIGQUIT, syscall.SIGTERM, syscall.SIGINT:
			log.Infof("http exit")
			return
		case syscall.SIGHUP:

		default:
			return
		}
	}
}
